<template>
<view>
<view v-for="(item, index) in shopList" :key="index">
   <view class="cont">
      <image :src="item.thumb_img"></image>
      <view class="rig">
         <view class="name">{{item.goods_name}}</view>
         <view>下单时间:{{item.add_time}}</view>
         <view class="rig-right yizf">积分 已支付</view>
         <view v-if="item.money_status==1" class="rig-right yizf">金额 已支付</view>
         <view v-if="item.money_status==0 && item.money>0" class="rig-right yizf">金额 未支付 </view>
         <view class="rig-right">共1件商品 实付总额：
            <text>{{item.price}}积分</text>
            <text v-if="item.money>0">+{{item.money}}元</text>
         </view>
      </view>
   </view>
</view>
<view v-if="shopList.length == 0" class="zanwu">
<image src="/static/remao_shop/img/noData.png"></image>
   <view>暂无订单</view>
</view>
</view>
</template>

<script>
// hotmall/packageB/IntegralDetailsOfCommodities/IntegralDetailsOfCommodities.js
var app = getApp();
import api from "../../../api";

export default {
  data() {
    return {
      userId: '',
      shopList: []
    };
  },

  components: {},
  props: {},

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    wx.getStorage({
      key: 'userId',
      success: res => {
        console.log(res);
        this.setData({
          userId: res.data
        });
        this.getList();
      }
    });
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {},

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {},

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {},

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {},

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
    this.getList();
    wx.stopPullDownRefresh();
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {},

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {},
  methods: {
    getList: function () {
      app.globalData.request({
        url: api.default.integral_integralOrder,
        header: {
          'content-type': 'application/x-www-form-urlencoded'
        },
        data: {
          uid: this.userId
        },
        method: 'POST',
        success: res => {
          console.log(res);
          this.setData({
            shopList: res
          });
        }
      });
    }
  }
};
</script>
<style>
@import "./integralOrder.css";
</style>